import processing.core.PImage;


public class ButtonPlusMinus extends Component {
	boolean pluState;
	public boolean pressed;
	public boolean active;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	public ButtonPlusMinus(String label)
	{
		super();
		pluState=true;
		width=15;
		height=15;
		this.label = label;
		active =false;
	}

	public void draw()
	{
		GLOBAL.processing.rectMode(GLOBAL.processing.CORNER);
		GLOBAL.processing.textFont(GLOBAL.plotBoldFont, 17);
		GLOBAL.processing.stroke(128);
		GLOBAL.processing.strokeWeight(1);
		GLOBAL.processing.fill(GLOBAL.textBoldColor);
		if(label.equals("Nationalities:")){
			GLOBAL.processing.textFont(GLOBAL.plotFont, 14);
			GLOBAL.processing.noFill();
			GLOBAL.processing.stroke(80);
			GLOBAL.processing.strokeWeight(2);
			GLOBAL.processing.rect(x-5, y-7, 150,30);
			GLOBAL.processing.fill(GLOBAL.textColor);	
		}
		GLOBAL.processing.strokeWeight(1);
		GLOBAL.processing.textAlign(GLOBAL.processing.LEFT);
		GLOBAL.processing.text(label, x + 20, y + 13);

		if(pluState)
			GLOBAL.processing.line(x+(int)((float)width/2 + 0.5), y, x+(int)((float)width/2 + 0.5), y+height);
		GLOBAL.processing.line(x, y+(int)((float)height/2 + 0.5), x+width, y+(int)((float)height/2 + 0.5));


		if(mouseOver()) 
		{
			if(!((GLOBAL.analysisType == 2 || GLOBAL.analysisType == 3) && label.equals("Nationalities:")))
				super.draw();
		}






	}



	////////////////////////////////////////////////////////////////////////////////////////////////////
	PImage icon;
	String label;

	public void mouseCliked() {
		pluState =!pluState;
	}
}
